home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-12-06 | 1.3 KB | 40 lines | [TEXT/ToyS] |
- on run
- set r to {}
- set srcFile to choose file with prompt "Choose a res file:"
- tell application "Finder" to get name of srcFile
- set dstFile to new file with prompt "Copy to:" default name result & ".rsrc"
- set r2 to 0
- set rf to res open srcFile
- try
- try
- res create dstFile creator type "RSED" file type "rsrc"
- on error number errNum
- if errNum = -48 then
- tell application "Finder" to delete dstFile
- res create dstFile creator type "RSED" file type "rsrc"
- end if
- end try
- set r2 to res open dstFile with write permission
-
- set rTypesCount to res count types rf
- repeat with i from 1 to rTypesCount
- set rType to res get type rf index i
- --tell application "Transcript" to «event miscEcho» rType --as string)
- set rCount to res count rf type rType
- set r to r & [rType, rCount]
- repeat with j from 1 to rCount
- --tell application "Transcript" to «event miscEcho» " " & j
- res put r2 type rType id 1000 + j data (res get rf type rType index j)
- end repeat
- --tell application "Transcript" to «event miscEcho» return
- end repeat
- beep 1
- on error errText number errNum from offendingObjectVariable
- if r2 ≠ 0 then res close r2
- res close rf
- error errText number errNum from offendingObjectVariable
- end try
- res close r2
- res close rf
- r
- end run